from lxml import etree							#导入lxml
text='''
<div>
	<ul>
		<li class="item-1"><a href="link1.html">第一个</a></li>
		<li class="item-2"><a href="link2.html">second item</a></li>
		<li class="item-3"><a href="link3.html">a属性</a>
	</ul>
</div>
'''											#定义字符串
html=etree.HTML(text)							#初始化生成一个XPath解析对象
result=etree.tostring(html,encoding='utf-8')			#解析对象输出代码
print(type(html))
print(type(result))
print(result.decode('utf-8'))
